package com.zigong.app.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ruihang.generalibrary.ui.adapter.BaseHolderAbsAdapter;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.zigong.app.R;
import com.zigong.app.beans.FChannel;
import com.zigong.app.beans.FProgram;
import com.zigong.app.ui.adapter.holder.RadioLivingHolder;
import com.zigong.app.ui.adapter.holder.TvLivingHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/7/13 0013.
 */

public class RadioLivingAdapter extends BaseHolderAbsAdapter<FChannel, RadioLivingHolder> {

    private int selectPos = -1;

    public RadioLivingAdapter(Context context, List<FChannel> list) {
        super(context, list);
        canSelector = true;
    }

    @Override
    public RadioLivingHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_radio_living, parent, false);
        RadioLivingHolder tvLivingHolder = new RadioLivingHolder(context, view);
        tvLivingHolder.setInternalClick(this);
        return tvLivingHolder;
    }

    @Override
    public RadioLivingAdapter setItemInternalClick(OnItemInternalClick itemInternalClick) {
        super.setItemInternalClick(itemInternalClick);
        return this;
    }

    @Override
    protected boolean isSelected(FChannel t, int position) {
        return position == selectPos;
    }

    public void setSelectPos(int selectPos) {
        this.selectPos = selectPos;
    }

    public int getSelectPos() {
        return selectPos;
    }
}
